# Starfish qmake configuration script
# By Matthew P. Del Buono
# Copyright (c) 2009 The Starfish Project
#
# This file is part of Starfish.
#
#    Starfish is free software: you can redistribute it and/or modify
#    it under the terms of the GNU Lesser General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    Starfish is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU Lesser General Public License for more details.
#
#    You should have received a copy of the GNU Lesser General Public License
#    along with Starfish.  If not, see <http://www.gnu.org/licenses/>.


# Always leave this line alone
TEMPLATE = app

# Build Configuration
# qt: Necessary always
# thread: Necessary always
# debug: Builds debug symbols in with the project
# release: Optimizes and strips debug symbols
# warn_on: Enables as many warnings as possible
# warn_off: Outputs as few warnings as possible
# console: Enable debugging console
CONFIG += qt thread debug warn_on

# Defines necessary QT libraries (beyond the default core and gui)
QT += network xml opengl sql

# Output location
DESTDIR = ../bin

# Object file location
OBJECTS_DIR = ../build

# Name of the executable
TARGET = starfish

# Specifies additional preprocessor defines
DEFINES +=

# Define additional libraries
# Use the form: -L/usr/local/lib -lmath
LIBS += 

# Header files (.h)
HEADERS += exitcodes.h

# Source files (.cpp)
SOURCES += main.cpp

# Qt forms (.ui)
FORMS +=

# Qt resources (.rc)
RESOURCES +=

# Precompiled Header File
PRECOMPILED_HEADER = precompiled.h

# Object script location, for use when too many files to link
QMAKE_LINK_OBJECT_SCRIPT = object_script

# Platform-specific configuration
win32 {
   debug {
      CONFIG += console
      DEFINES += STATIC_LUA           
   }
}
unix {
   system("pkg-config --exists lua5.1") {
      CONFIG += link_pkgconfig
      PKGCONFIG += lua5.1
      DEFINES += DYNAMIC_LUA
   } else {
      system("pkg-config --exists lua") {
         CONFIG += link_pkgconfig
	 PKGCONFIG += lua
         DEFINES += DYNAMIC_LUA
      } else {
         error(Lua cannot be found on your system.)
      }
   }
}
macx {
   # TODO: Figure out whether to do this as static or dynamic
   # Currently we use static build
   DEFINES += STATIC_LUA
}

contains(DEFINES, STATIC_LUA) {
      # Static Lua build
      SOURCES += lua/lapi.c                 \
                 lua/lauxlib.c              \
        	 lua/lbaselib.c             \
        	 lua/lcode.c                \
        	 lua/ldblib.c               \
        	 lua/ldebug.c               \
        	 lua/ldo.c                  \
        	 lua/ldump.c                \
        	 lua/lfunc.c                \
        	 lua/lgc.c                  \
        	 lua/linit.c                \
        	 lua/liolib.c               \
        	 lua/llex.c                 \
        	 lua/lmathlib.c             \
        	 lua/lmem.c                 \
        	 lua/loadlib.c              \
        	 lua/lobject.c              \
        	 lua/lopcodes.c             \
        	 lua/loslib.c               \
        	 lua/lparser.c              \
        	 lua/lstate.c               \
        	 lua/lstring.c              \
        	 lua/lstrlib.c              \
        	 lua/ltable.c               \
        	 lua/ltablib.c              \
        	 lua/ltm.c                  \
        	 lua/lundump.c              \
		 lua/lvm.c                  \
        	 lua/lzio.c  

	 HEADERS += lua/lapi.h              \
                    lua/lauxlib.h           \
        	    lua/lcode.h             \
        	    lua/ldebug.h            \
        	    lua/ldo.h               \
        	    lua/lfunc.h             \
        	    lua/lgc.h               \
        	    lua/llex.h              \
        	    lua/llimits.h           \
        	    lua/lmem.h              \
        	    lua/lobject.h           \
        	    lua/lopcodes.h          \
        	    lua/lparser.h           \
        	    lua/lstate.h            \
        	    lua/lstring.h           \
        	    lua/ltable.h            \
        	    lua/ltm.h               \
        	    lua/lua.h               \
        	    lua/luaconf.h           \
        	    lua/lualib.h            \
        	    lua/lundump.h           \
        	    lua/lvm.h               \
        	    lua/lzio.h              
}

# Documentation target
doxygen.target = doc
doxygen.commands = doxygen
doxygen.depends = FORCE
QMAKE_EXTRA_TARGETS += doxygen

# Ignore the check target
check.target = check
check.commands =
QMAKE_EXTRA_TARGETS += check

